import request from '../../../utils/unirequest';
import type { ILoginParams, ILoginResult, IUserInfo } from './interface';
import type { LuchResponse } from '../../../type/common';
export default function useLoginApi() {
  return {
    // 账号密码登录接口
    login: (data: ILoginParams): Promise<LuchResponse<ILoginResult>> => request.post('/api/_account/loginjwt', data),
    // 发送登录短信
    sendLoginSms: (data: {
      Mobile: string, Type: "login" | "guestBind"
    }): Promise<LuchResponse> => request.post('/api/_account/sendloginsms', data),
    // 验证登录短信
    loginBySms: (data: { Mobile: string, Code: string }): Promise<LuchResponse> => request.post('/api/_account/loginbysms', data),
    // 游客登录
    wechatGuestLogin: (data: { WechatKey: string }): Promise<LuchResponse> => request.post('/api/_account/WechatMiniProgramGuestLogin', data),
    // 微信登录
    wechatMiniProgramLogin: (data: { Code: string }): Promise<LuchResponse> => request.post('/api/_account/wechatminiprogramlogin', data),
    // 微信绑定手机号
    wechatBindByMobile: (data: { Mobile: string, SmsCode: string, WechatKey: string }): Promise<LuchResponse<ILoginResult>> => request.post('/api/_account/wechatbindbymobile', data),
    // 获取用户信息
    getUserInfo: (): Promise<IUserInfo> => request.get('/api/_account/checkuserinfo'),
    // 游客绑定手机号
    GuestBindExistingAccount: (data: { Mobile: string, Code: string }): Promise<LuchResponse<ILoginResult>> => request.post('/api/_account/GuestBindExistingAccount', data),
  }
}



